from flask import jsonify


class Result:
    """
    最终响应结果
    """
    code: int
    message: str
    data: object

    def __init__(self, code, message, data):
        self.code = code
        self.message = message
        self.data = data

    def to_response(self):
        """直接返回 Flask 的响应对象"""
        return jsonify({"code": self.code, "message": self.message, "data": self.data})